import { ref } from 'vue'
import { useUserStore } from '@/stores/userStore'
import { storeToRefs } from 'pinia'

export default function () {
  const { users, pageTotal } = storeToRefs(useUserStore())
  const { select } = useUserStore()

  const isSelected = ref<string>('')
  const { assignUsers } = useUserStore()
  const page = ref<HTMLDivElement | null>(null)
  const showPage = ref(true)
  const pageSize = ref(50)
  // 点击换页
  function clickPage(page: number) {
    assignUsers(page)
  }

  return {
    isSelected,
    users,
    page,
    showPage,
    pageSize,
    pageTotal,
    select,
    clickPage,
    assignUsers
  }
}
